/*
 * Created on March 8, 2007
 * 
 * Copyright (c) Patrick Armstrong 2002-2007. All Rights Reserved
 */
package org.dime.mine.game.actions;

import org.dime.mine.game.Board;

/**
 * Mark // TODO Add type summary
 * 
 * @author Owner
 */
public class Mark extends ReversibleAction
{
    /**
     * 
     */
    public Mark(Board.Location location)
    {
        super(location);
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.dime.mine.game.Action#execute()
     */
    public void execute()
    {
        getLocation().setMarked(true);
    }

    public void undo()
    {
        getLocation().setMarked(false);
    }

    @Override
    public String toString()
    {
        return "Mark [" + getLocation().getRow() + ", "
                + getLocation().getColumn() + "]";
    }

    // TODO evaluate whether this should be more generalized
    public static boolean isMarkable(Board.Location loc)
    {
        return !(loc.isMarked() || loc.isOpen());
    }
}
